<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div>
    {{info}}
    <ul>
        <!--v-for="变量"-->
        <li v-for="name in arr">{{name}}</li>
    </ul>
    <table border="1">
        <caption>商品列表</caption>
        <tr><th>编号</th><th>商品标题</th><th>商品价格</th><th>商品库存</th></tr>
        <!--key给元素生成出来的元素设置一个唯一标识符,当需要对生成的元素进行删除或操作时如果没有这个唯一标识附-->
        <tr  v-for="(p,i) in productArr" :key="i">
            <td>{{i}}</td>
            <td>{{p.title}}</td>
            <td>{{p.price}}</td>
            <td>{{p.num}}</td>
        </tr>
    </table>
</div>
<script src="js/Vue.js"></script>
<script>
    Vue.createApp({
        data(){
            return {
                info:"循环遍历",
                arr:["蔡徐坤","陈立农","范丞丞"],
                productArr:[{title:"苹果手机",price:"2999",num:"122"},
                    {title:"华为手机",price:"29999",num:"2"},
                    {title:"小米手机",price:"29990",num:"22"}]
            }
        },
    }).mount("body>div")
</script>
</body>
</html>